package com.dorm.cj.chain;

public class DealFactory {

    // 制定一套处理链，即指定处理顺序，可以有很多扩展，不一定局限于指定下一个处理类
    public static Deal getDealChain() {
        DealOne dealOne = new DealOne();
        DealTwo dealTwo = new DealTwo();
        DealThree dealThree = new DealThree();

        dealOne.setNextDeal(dealTwo);
        dealTwo.setNextDeal(dealThree);
        return dealOne;
    }

    /**
     * 比如FilterChain,可以定义Filter接口实现order，动态获取所有实现，按照顺序执行
     * spring:ApplicationContext.getBeanOfType(Filter.class);
     */

    interface Filter {
        int getOrder();

        String getName();
    }
}
